<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>CBI建筑网搜索引擎demo</title>
    <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link href="{{ url_for('static', filename='css/pagestyle.css') }}" rel="stylesheet">
    <style>
        em { color: #c00; font-style: normal}
    </style>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->

    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
    <div class="container">
        <header>
            <h1>CBI建筑网搜索引擎demo</h1>
            <h6>共获得<em>{{ count }}</em>条结果</h6>
        </header>

        <div id="main">
            <div id="content">
                <form id="fromSearch" class="form-inline" action="/" method="get">
                    <div class="form-group">
                        <label for="query">公司</label>
                        <input type="text" class="form-control" id="query" name="query" placeholder="公司名" value="{{ query }}">
                    </div>
                    <select class="form-control" name="mode">
                        <option value="1" {% if mode == '1' %}selected{% endif %}>有中标</option>
                        <option value="0" {% if mode == '0' %}selected{% endif %}>全部</option>
                    </select>
                    <button type="submit" class="btn btn-primary">搜索</button>
                     <input type="hidden" id="pageIndex" name="pageIndex" value="1">
                </form>
            </div>
            <div>
                <table class="table table-condensed">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>公司</th>
                            <th>中标数</th>
                            <th>建造师</th>
                            <th>资质数目</th>
                            <th>黑名单</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for hit in hints %}
                            <tr>
                                <td>{{ loop.index }}</td>
                                <td>{{ hit.highlight | safe }}</td>
                                <td>{% if hit.TenderCount %}{{ hit.TenderCount }}{% else %}0{% endif %}</td>
                                <td>{% if hit.BuilderCount %}{{ hit.BuilderCount }}{% else %}0{% endif %}</td>
                                <td>{% if hit.TechCount %}{{ hit.TechCount }}{% else %}0{% endif %}</td>
                                <td>{% if hit.BlackCount %}{{ hit.BlackCount }}{% else %}0{% endif %}</td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
        <div class="tcdPageCode"></div>
        <footer class="text-center">
                更多咨询，请联系<a href="mailto:tccc123@163.com">tccc123@163.com</a>
        </footer>
    </div>
    <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
    <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script src="{{ url_for('static', filename='js/jquery.page.js') }}"></script>
    <script>
        $(".tcdPageCode").createPage({
            pageCount: Number({{ pageCount }}),
            current: Number( {{ pageIndex }} ),
            backFn: function(p) {
                $("#pageIndex").val(p);
                $("#fromSearch").submit();
            }
        });
    </script>
</body>
</html>